package com.cw;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.cw.service.BaseService;

public class Context {

	private static Context instance = new Context();
	private ApplicationContext ac = null;
	
	private Context() {
		loadAppContext();
	}
	
	private void loadAppContext(){
		ac = new ClassPathXmlApplicationContext("/applicationContext.xml");
	}
	
	public BaseService getBean(String name) {
		return (BaseService) ac.getBean(name);
	}

	public static Context getInstance(){
		return instance;
	}

}
